<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="技术,分享,生活">
    <meta name="description" content="这里是anlondon,欢迎留言交流">
    <meta name="author" content="anlondon">
    
    <title>
        
            8.1多任务处理中心 |
        
        一座浮岛
    </title>
    
<link rel="stylesheet" href="/css/style.css">

    <link rel="shortcut icon" href="/images/logo_my.png">
    
<link rel="stylesheet" href="/fontawesome/css/fontawesome.min.css">

    
<link rel="stylesheet" href="/fontawesome/css/regular.min.css">

    
<link rel="stylesheet" href="/fontawesome/css/solid.min.css">

    
<link rel="stylesheet" href="/fontawesome/css/brands.min.css">

    <script id="hexo-configurations">
    let KEEP = window.KEEP || {};
    KEEP.hexo_config = {"hostname":"example.com","root":"/","language":"en","path":"search.json"};
    KEEP.theme_config = {"toc":{"enable":true,"number":true,"expand_all":true,"init_open":true},"style":{"primary_color":"#557ea2","logo":"/images/logo_my.png","favicon":"/images/logo_my.png","avatar":"/images/avatar_my.svg","font_size":null,"font_family":"STKaiti","hover":{"shadow":true,"scale":true},"first_screen":{"enable":true,"header_transparent":false,"background_img":"https://api.likepoems.com/img/nature","description":null,"font_color":null,"hitokoto":true},"scroll":{"progress_bar":false,"percent":false}},"local_search":{"enable":true,"preload":true},"code_copy":{},"code_block":{"tools":{"enable":true,"style":"default"},"highlight_theme":"obsidian"},"side_tools":{},"pjax":{"enable":true},"lazyload":{"enable":true},"comment":{"enable":true,"use":"valine","valine":{"appid":"v7SvjMu6zFX3LPmiYGos39qx-gzGzoHsz","appkey":"MlLOMElKkabjL3SHiqXhFWAW","placeholder":null},"gitalk":{"github_id":null,"github_admins":null,"repository":null,"client_id":null,"client_secret":null},"twikoo":{"env_id":null,"region":null,"version":"1.6.7"},"waline":{"server_url":null,"reaction":false,"version":2}},"post":{"author_label":{"enable":true,"auto":true,"custom_label_list":["Trainee","Engineer","Architect"]},"word_count":{"enable":true,"wordcount":true,"min2read":true},"img_align":"left","copyright_info":false},"version":"3.5.2"};
    KEEP.language_ago = {"second":"%s seconds ago","minute":"%s minutes ago","hour":"%s hours ago","day":"%s days ago","week":"%s weeks ago","month":"%s months ago","year":"%s years ago"};
    KEEP.language_code_block = {"copy":"Copy code","copied":"Copied","fold":"Fold code block","folded":"Folded"};
  </script>
<meta name="generator" content="Hexo 5.4.0"></head>


<body>
<!-- anlondon 加的 start -->
<div class="background-my"></div>
<!-- anlondon 加的 end-->
<div class="progress-bar-container">
    

    
        <span class="pjax-progress-bar"></span>
        <i class="pjax-progress-icon fas fa-circle-notch fa-spin"></i>
    
</div>


<main class="page-container">

    

    <div class="page-main-content">

        <div class="page-main-content-top">
            
<header class="header-wrapper">

    <div class="header-content">
        <div class="left">
            
                <a class="logo-image" href="/">
                    <img src="/images/logo_my.png">
                </a>
            
            <a class="logo-title" href="/">
               一座浮岛
            </a>
        </div>

        <div class="right">
            <div class="pc">
                <ul class="menu-list">
                    
                        <li class="menu-item">
                            <a class=""
                               href="/"
                            >
                                首页
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/archives"
                            >
                                时间流
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/categories"
                            >
                                归档
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/links"
                            >
                                LINKS
                            </a>
                        </li>
                    
                        <li class="menu-item">
                            <a class=""
                               href="/about"
                            >
                                关于
                            </a>
                        </li>
                    
                    
                        <li class="menu-item search search-popup-trigger">
                            <i class="fas fa-search"></i>
                        </li>
                    
                </ul>
            </div>
            <div class="mobile">
                
                    <div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div>
                
                <div class="icon-item menu-bar">
                    <div class="menu-bar-middle"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="header-drawer">
        <ul class="drawer-menu-list">
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/">首页</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/archives">时间流</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/categories">归档</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/links">LINKS</a>
                </li>
            
                <li class="drawer-menu-item flex-center">
                    <a class=""
                       href="/about">关于</a>
                </li>
            
        </ul>
    </div>

    <div class="window-mask"></div>

</header>


        </div>

        <div class="page-main-content-middle">

            <div class="main-content">

                
                    <div class="fade-in-down-animation">
    <div class="post-page-container">
        <div class="article-content-container">

            <div class="article-title">
                <span class="title-hover-animation">8.1多任务处理中心</span>
            </div>

            
                <div class="article-header">
                    <div class="avatar">
                        <img src="/images/avatar_my.svg">
                    </div>
                    <div class="info">
                        <div class="author">
                            <span class="name">anlondon</span>
                            
                                <span class="author-label">Lv6</span>
                            
                        </div>
                        <div class="meta-info">
                            
<div class="article-meta-info">
    <span class="article-date article-meta-item">
        
            <i class="fa-regular fa-calendar-plus"></i>&nbsp;
        
        <span class="pc">2021-06-21 22:04:00</span>
        <span class="mobile">2021-06-21 22:04</span>
    </span>
    
        <span class="article-update-date article-meta-item">
        <i class="fas fa-file-pen"></i>&nbsp;
        <span class="pc">2021-06-24 22:26:32</span>
    </span>
    
    
        <span class="article-categories article-meta-item">
            <i class="fas fa-folder"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/categories/swoole/">swoole</a>&nbsp;
                    </li>
                
                    <li>
                        &gt; <a href="/categories/swoole/%E5%9F%BA%E7%A1%80%E4%BA%86%E8%A7%A3/">基础了解</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    
    
        <span class="article-tags article-meta-item">
            <i class="fas fa-tags"></i>&nbsp;
            <ul>
                
                    <li>
                        <a href="/tags/swoole/">swoole</a>&nbsp;
                    </li>
                
            </ul>
        </span>
    

    
    
    
    
        <span class="article-pv article-meta-item">
            <i class="fas fa-eye"></i>&nbsp;<span id="busuanzi_value_page_pv"></span>
        </span>
    
</div>

                        </div>
                    </div>
                </div>
            

            <div class="article-content keep-markdown-body">
                <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/hint.css/2.4.1/hint.min.css"><h1 id="8-1多任务处理中心"><a href="#8-1多任务处理中心" class="headerlink" title="8.1多任务处理中心"></a>8.1多任务处理中心</h1><h2 id="什么叫多任务处理中心？"><a href="#什么叫多任务处理中心？" class="headerlink" title="什么叫多任务处理中心？"></a>什么叫多任务处理中心？</h2><p>php属于单线程应用，每次只能处理一个任务，然而当项目越来越复杂越来越庞大时，单线程就难以支撑庞大繁多的任务处理，而有的任务会因为网络/用户反应时间等原因，导致框架需要得到某些数据却迟迟得不到使得任务阻塞。</p>
<blockquote>
<p>如1万个用户中一部分在付款等待付款结果，一部分在下单，一部分在等待短信通知，这些任务都会有一定的处理延迟，如果使用php框架处理，就会影响运行效率和用户体验。<br>而多任务处理中心则是独立于框架外，可以高效并同时处理多个任务的swoole模块(Swoole\Process)<br>如上述的例子，当框架遇到一些需要等待较久且使用频繁的功能时，可以将任务传递给Swoole的多任务处理中心，处理中心可以同时运行并根据需要返回结果，而php框架主体应用不会产生阻塞等待，可以更加专注于自己的任务</p>
</blockquote>
<h2 id="为什么需要多任务处理中心？"><a href="#为什么需要多任务处理中心？" class="headerlink" title="为什么需要多任务处理中心？"></a>为什么需要多任务处理中心？</h2><ul>
<li>在大流量高并发下为一部任务提供快速消费的能力</li>
<li>实现业务逻辑的解耦，避免系统故障</li>
<li>对人物做数据的轨迹、存储、挖掘、分析之类的工作</li>
</ul>
<h2 id="简单的实例"><a href="#简单的实例" class="headerlink" title="简单的实例"></a>简单的实例</h2><ul>
<li><p>模拟10个任务,每个任务需要一秒钟</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span>(<span class="variable">$i</span>=<span class="number">0</span>;<span class="variable">$i</span>&lt;<span class="number">10</span>;<span class="variable">$i</span>++)&#123;</span><br><span class="line">    sleep(<span class="number">1</span>);</span><br><span class="line">    <span class="keyword">echo</span> <span class="string">&#x27;正在执行任务&#x27;</span>.(<span class="variable">$i</span>+<span class="number">1</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>运行结果</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">[hime@192 swoole-sixstartedu]$ time php job&#x2F;process.php </span><br><span class="line">正在执行任务1</span><br><span class="line">正在执行任务2</span><br><span class="line">正在执行任务3</span><br><span class="line">正在执行任务4</span><br><span class="line">正在执行任务5</span><br><span class="line">正在执行任务6</span><br><span class="line">正在执行任务7</span><br><span class="line">正在执行任务8</span><br><span class="line">正在执行任务9</span><br><span class="line">正在执行任务10</span><br><span class="line"></span><br><span class="line">real	0m10.053s</span><br><span class="line">user	0m0.026s</span><br><span class="line">sys	0m0.009s</span><br></pre></td></tr></table></figure></li>
<li><p>使用Swoole 提供的进程管理模块模拟十个任务</p>
<figure class="highlight php"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span>(<span class="variable">$k</span>=<span class="number">0</span>;<span class="variable">$k</span>&lt;<span class="number">10</span>;<span class="variable">$k</span>++)&#123;</span><br><span class="line">    <span class="variable">$process</span> = <span class="keyword">new</span> Swoole\Process(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">        <span class="comment">//子进程</span></span><br><span class="line">        sleep(<span class="number">10</span>);</span><br><span class="line">        <span class="keyword">echo</span> <span class="string">&#x27;:正在执行任务&#x27;</span>.PHP_EOL;</span><br><span class="line">    &#125;);</span><br><span class="line">    <span class="variable">$process</span>-&gt;start();<span class="comment">//启动进程，创建进程</span></span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//[hime@192 swoole-sixstartedu]$ time php job/process.php</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"><span class="comment">//:正在执行任务</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//real	0m10.347s</span></span><br><span class="line"><span class="comment">//user	0m0.132s</span></span><br><span class="line"><span class="comment">//sys	0m2.200s</span></span><br></pre></td></tr></table></figure>
<p>for循环制造了10个任务（sleep在实例process中，因此对for循环没有影响），并通过Process处理，10个任务同时进行，因此整体时间花费只在10s+<br>从上面实例可以看出,swoole的进程处理是十分高效的，可以同时执行多个任务。<br>p9:50分钟左右，讲解任务处理中心的功能分层（主进程，接收任务进程，执行任务进程，监听回收进程，进程间通信!</p>
</li>
</ul>
<p><img  
                     lazyload
                     alt="image"
                     data-src="/2021/06/21/8-1%E5%A4%9A%E4%BB%BB%E5%8A%A1%E5%A4%84%E7%90%86%E4%B8%AD/pasted-0.png"
                      alt="一座浮岛"
                ></p>

            </div>

            

            
                <ul class="post-tags-box">
                    
                        <li class="tag-item">
                            <a href="/tags/swoole/">#swoole</a>&nbsp;
                        </li>
                    
                </ul>
            

            
                <div class="article-nav">
                    
                        <div class="article-prev">
                            <a class="prev"
                               rel="prev"
                               href="/2021/06/21/7-TCP%E5%92%8CUDP%E4%BB%8B%E7%BB%8D/"
                            >
                            <span class="left arrow-icon flex-center">
                              <i class="fas fa-chevron-left"></i>
                            </span>
                                <span class="title flex-center">
                                <span class="post-nav-title-item">7. TCP和UDP介绍</span>
                                <span class="post-nav-item">Prev posts</span>
                            </span>
                            </a>
                        </div>
                    
                    
                        <div class="article-next">
                            <a class="next"
                               rel="next"
                               href="/2021/06/21/6-1-%E5%90%8C%E6%AD%A5%E5%BC%82%E6%AD%A5/"
                            >
                            <span class="title flex-center">
                                <span class="post-nav-title-item">6.1 同步异步</span>
                                <span class="post-nav-item">Next posts</span>
                            </span>
                                <span class="right arrow-icon flex-center">
                              <i class="fas fa-chevron-right"></i>
                            </span>
                            </a>
                        </div>
                    
                </div>
            

            
                <div class="comment-container">
                    
<div class="comments-container">
    <div id="comments-anchor"></div>
    <div class="comment-area-title">
        <i class="fas fa-comments"></i>&nbsp;Comments
    </div>
    
        
            

    <div class="valine-container">
        <script data-pjax src="//cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js"></script>
        <div id="vcomments"></div>
        <script data-pjax>
          function loadValine() {
            new Valine({
              el: '#vcomments',
              appId: 'v7SvjMu6zFX3LPmiYGos39qx-gzGzoHsz',
              appKey: 'MlLOMElKkabjL3SHiqXhFWAW',
              meta: ['nick', 'mail', 'link'],
              avatar: 'wavatar',
              enableQQ: true,
              placeholder: '',
              lang: 'en'.toLowerCase()
            });

            function getAuthor(language) {
              switch (language) {
                case 'en':
                  return 'Author';
                case 'zh-CN':
                  return '博主';
                default:
                  return 'Master';
              }
            }

            // Add "Author" identify
            const getValineDomTimer = setInterval(() => {
              const vcards = document.querySelectorAll('#vcomments .vcards .vcard');
              if (vcards.length > 0) {
                let author = 'anlondon';

                if (author) {
                  for (let vcard of vcards) {
                    const vnick_dom = vcard.querySelector('.vhead .vnick');
                    const vnick = vnick_dom.innerHTML;
                    if (vnick === author) {
                      vnick_dom.innerHTML = `${vnick} <span class="author">${getAuthor(KEEP.hexo_config.language)}</span>`
                    }
                  }
                }
                clearInterval(getValineDomTimer);
              } else {
                clearInterval(getValineDomTimer);
              }
            }, 2000);
          }

          if ('true' === 'true') {
            const loadValineTimeout = setTimeout(() => {
              loadValine();
              clearTimeout(loadValineTimeout);
            }, 1000);
          } else {
            window.addEventListener('DOMContentLoaded', loadValine);
          }
        </script>
    </div>



        
    
</div>

                </div>
            
        </div>

        
            <div class="toc-content-container">
                <div class="post-toc-wrap">
    <div class="post-toc">
        <ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#8-1%E5%A4%9A%E4%BB%BB%E5%8A%A1%E5%A4%84%E7%90%86%E4%B8%AD%E5%BF%83"><span class="nav-number">1.</span> <span class="nav-text">8.1多任务处理中心</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%80%E4%B9%88%E5%8F%AB%E5%A4%9A%E4%BB%BB%E5%8A%A1%E5%A4%84%E7%90%86%E4%B8%AD%E5%BF%83%EF%BC%9F"><span class="nav-number">1.1.</span> <span class="nav-text">什么叫多任务处理中心？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%BA%E4%BB%80%E4%B9%88%E9%9C%80%E8%A6%81%E5%A4%9A%E4%BB%BB%E5%8A%A1%E5%A4%84%E7%90%86%E4%B8%AD%E5%BF%83%EF%BC%9F"><span class="nav-number">1.2.</span> <span class="nav-text">为什么需要多任务处理中心？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%AE%80%E5%8D%95%E7%9A%84%E5%AE%9E%E4%BE%8B"><span class="nav-number">1.3.</span> <span class="nav-text">简单的实例</span></a></li></ol></li></ol>
    </div>
</div>

            </div>
        
    </div>
</div>


                
            </div>

        </div>

        <div class="page-main-content-bottom">
            
<footer class="footer">
    <div class="info-container">
        <div class="copyright-info info-item">
            &copy;
            
                <span>2020</span> -
            
            2023
            
                &nbsp;<i class="fas fa-heart icon-animate"></i>
                &nbsp;<a href="/">anlondon</a>
            
        </div>
        
            <script async data-pjax
                    src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
            <div class="website-count info-item">
                
                    Visitor Count&nbsp;<span id="busuanzi_value_site_uv"></span>&ensp;
                
                
                    Totalview&nbsp;<span id="busuanzi_value_site_pv"></span>
                
            </div>
        
        <div class="theme-info info-item">
            Powered by <a target="_blank" href="https://hexo.io">Hexo</a>&nbsp;|&nbsp;Theme&nbsp;<a class="theme-version" target="_blank" href="https://github.com/XPoet/hexo-theme-keep">Keep v3.5.2</a>
        </div>
        
            <div class="icp-info info-item">
                <a target="_blank" rel="nofollow"
                   href="https://beian.miit.gov.cn"
                >
                    蜀ICP备2021002582号
                </a>

                <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=51010602001866" style="display:inline-block;text-decoration:none;height:17px;line-height:17px;">
                    <img src="https://www.beian.gov.cn/img/new/gongan.png" style="float:left;"/>
                    <p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px;">川公网安备 51010602001866号</p>
                </a>

            </div>
        
        
    </div>
</footer>

        </div>
    </div>

    
        <div class="post-tools">
            <div class="post-tools-container">
    <ul class="tools-list">
        <!-- TOC aside toggle -->
        
            <li class="tools-item flex-center toggle-show-toc">
                <i class="fas fa-list"></i>
            </li>
        

        <!-- go comment -->
        
            <li class="tools-item flex-center go-to-comments">
                <i class="fas fa-comment"></i>
                <span class="post-comments-count"></span>
            </li>
        
    </ul>
</div>

        </div>
    

    <div class="right-bottom-side-tools">
        <div class="side-tools-container">
    <ul class="side-tools-list">
        <li class="tools-item tool-font-adjust-plus flex-center">
            <i class="fas fa-search-plus"></i>
        </li>

        <li class="tools-item tool-font-adjust-minus flex-center">
            <i class="fas fa-search-minus"></i>
        </li>

        <li class="tools-item tool-dark-light-toggle flex-center">
            <i class="fas fa-moon"></i>
        </li>

        <!-- rss -->
        

        
            <li class="tools-item tool-scroll-to-top flex-center">
                <i class="fas fa-arrow-up"></i>
            </li>
        

        <li class="tools-item tool-scroll-to-bottom flex-center">
            <i class="fas fa-arrow-down"></i>
        </li>
    </ul>

    <ul class="exposed-tools-list">
        <li class="tools-item tool-toggle-show flex-center">
            <i class="fas fa-cog fa-spin"></i>
        </li>
        
    </ul>
</div>

    </div>

    <div class="zoom-in-image-mask">
    <img class="zoom-in-image">
</div>


    
        <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
          <span class="search-input-field-pre">
            <i class="fas fa-keyboard"></i>
          </span>
            <div class="search-input-container">
                <input autocomplete="off"
                       autocorrect="off"
                       autocapitalize="off"
                       placeholder="Search..."
                       spellcheck="false"
                       type="search"
                       class="search-input"
                >
            </div>
            <span class="close-popup-btn">
                <i class="fas fa-times"></i>
            </span>
        </div>
        <div id="search-result">
            <div id="no-result">
                <i class="fas fa-spinner fa-pulse fa-5x fa-fw"></i>
            </div>
        </div>
    </div>
</div>

    

</main>




<script src="/js/utils.js"></script>

<script src="/js/main.js"></script>

<script src="/js/header-shrink.js"></script>

<script src="/js/back2top.js"></script>

<script src="/js/dark-light-toggle.js"></script>





    
<script src="/js/local-search.js"></script>




    
<script src="/js/code-block.js"></script>




    
<script src="/js/lazyload.js"></script>



<div class="post-scripts pjax">
    
        
<script src="/js/post-helper.js"></script>

        
            
<script src="/js/libs/anime.min.js"></script>

        
        
            
<script src="/js/toc.js"></script>

        
    
</div>


    
<script src="/js/libs/pjax.min.js"></script>

<script>
    window.addEventListener('DOMContentLoaded', () => {
        window.pjax = new Pjax({
            selectors: [
                'head title',
                '.page-container',
                '.pjax'
            ],
            history: true,
            debug: false,
            cacheBust: false,
            timeout: 0,
            analytics: false,
            currentUrlFullReload: false,
            scrollRestoration: false,
            // scrollTo: true,
        });

        document.addEventListener('pjax:send', () => {
            KEEP.utils.pjaxProgressBarStart();
        });

        document.addEventListener('pjax:complete', () => {
            KEEP.utils.pjaxProgressBarEnd();
            window.pjax.executeScripts(document.querySelectorAll('script[data-pjax], .pjax script'));
            KEEP.refresh();
        });
    });
</script>



</body>
</html>
